//
//  threeImageCell.m
//  LoveLove
//
//  Created by 吴志强 on 2019/5/30.
//  Copyright © 2019 wkf. All rights reserved.
//

#import "threeImageCell.h"

@implementation threeImageCell

- (void) setview
{
    float totalwidth = [[UIScreen mainScreen] bounds].size.width-40;

    self.contentTextLbl = [LLInitBaseViewTool labelWithText:nil textColor:UIColor.blackColor font:19 textAlignment:NSTextAlignmentLeft];
    self.contentTextLbl.frame = CGRectMake(20, 20, [[UIScreen mainScreen] bounds].size.width-40, 40);
    self.contentTextLbl.numberOfLines = 3;
    [self.contentView addSubview:self.contentTextLbl];

    float width = (totalwidth-20)/3;
    for (int i = 0; i<3; i++) {

        float left = i <= 2 ? 10 : 0;

        UIImageView *image = UIImageView.new;
        image.frame = CGRectMake(20+(width+left)*i, self.contentTextLbl.bottom+10, width, 80);
        image.layer.cornerRadius = 2;
        image.clipsToBounds = YES;
        image.tag = 1000+i;
        image.contentMode = UIViewContentModeScaleAspectFill;
        [self.contentView addSubview:image];
    }
    self.bottomInfoLbl = [LLInitBaseViewTool labelWithText:nil textColor:LLColorRGB(131) font:11 textAlignment:NSTextAlignmentLeft];
    self.bottomInfoLbl.frame = CGRectMake(20, self.contentTextLbl.bottom+100, [[UIScreen mainScreen] bounds].size.width-70, 20);
    [self.contentView addSubview:self.bottomInfoLbl];

    self.editBtn = [LLInitBaseViewTool buttonWithTitle:nil image:@"close_edit" titleColor:nil font:0];
    self.editBtn.frame = CGRectMake([[UIScreen mainScreen] bounds].size.width-40, self.contentTextLbl.bottom+100, 20, 20);
    [self.editBtn addTarget:self action:@selector(editBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:self.editBtn];

    [self.img removeFromSuperview];
//    self.contentTextLbl.backgroundColor = [UIColor greenColor];
//    self.bottomInfoLbl.backgroundColor = [UIColor greenColor];
//    self.editBtn.backgroundColor = [UIColor greenColor];
}

- (void) setModel:(LLStatusModel *)model
{
    [super setModel:model];

    for (int i = 0; i<3; i++) {

        UIImageView *image = [self.contentView viewWithTag:1000+i];
        [image sd_setImageWithURL:LLImageWithUrl(model.img_url[i]) placeholderImage:[UIImage imageNamed:@"placeholder"] options:SDWebImageRefreshCached];
    }
    self.contentTextLbl.text = [NSString stringWithFormat:@"%@",model.newsTitle];
    self.bottomInfoLbl.text = [NSString stringWithFormat:@"%@  浏览量:%@  %@评论  %@",model.u_name,model.look_num,model.comment_num,model.time];
}

- (void) editBtnClick
{

}

@end
